import torch.nn as nn
import math
import numpy as np
import os
import torch

class conv_dw(nn.Module):
    def __init__(self,input_channel,kernel_size,stride):
        super(conv_dw,self).__init__()
        self.stride = stride
        self.kernel_size = kernel_size
        self.num = input_channel
        self.conv = nn.ModuleList()
        for i in range(self.num):
            self.conv.append(nn.Conv2d(1,1,3,self.stride,1,bias=False))
            #self.bias[i] = nn.Parameter(torch.zeros(1))

    def forward(self,input):
        output=[]
        for j in range(self.num):
            x = input[:, j]
            y = self.conv[j](x[j])
            output = torch.cat([output,y],dim = 1)
        return output
nn= conv_dw(32,3,2)
for n in nn.modules():
    print(n)
    if isinstance(n, nn.Conv2d):
        print(True)


